﻿#include <iostream>
#include <utility> // std::move

class MyClass {
public:
    MyClass() {
        std::cout << "Default constructor" << std::endl;
    }

    MyClass(const MyClass&) {
        std::cout << "Copy constructor" << std::endl;
    }

    MyClass(MyClass&&) {
        std::cout << "Move constructor" << std::endl;
    }

    ~MyClass(){
        std::cout << "~MyClass constructor" << std::endl;
    }
};

MyClass func() {
    MyClass my;
    return my;
}

int main() {
    //MyClass obj1;
    //MyClass obj2 = std::move(obj1);  // 调用移动构造函数
    MyClass obj3 = func();
    return 0;
}
